﻿<!doctype html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<head>
	<title>信息采集</title>
	<link rel="stylesheet" type="text/css" href="css/ch2.basis.css">
	<link rel="stylesheet" type="text/css" href="css/ch2.dialog.css">
	<link rel="stylesheet" type="text/css" href="font/4.2.0/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/ch2.pager.css">
	<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
	<script type="text/javascript" src="js/ch2.dialog.js"></script>
	<script type="text/javascript" src="js/jsviews.min.js"></script>
	<script type="text/javascript" src="js/ch2.js"></script>
	<script type="text/javascript" src="js/ch2.pager.js"></script>
</head>
<body>
	<div id="header">
		<div class="ctrls"> 
			<a id="window-min" class="win-min" onclick="windowCommand('min')"><i class="fa fa-angle-double-down"></i></a>
        	<a id="window-max" class="win-max" onclick="this.innerHTML = windowCommand('max')?'<i class=&quot;fa fa-compress&quot;></i>':'<i class=&quot;fa fa-expand&quot;></i>';"><i class="fa fa-expand"></i></a>
        	<a id="window-close" class="win-close" onclick="windowCommand('close')"><i class="fa fa-close"></i></a>
		</div>
		<div class="title-bar" onmousedown="windowCommand('drag')"> <span class="title">信息采集</span></div>
	</div> 
	
	<div style="margin:10px;">
	<div class="m-htab m-htab-green m-htab-sm">
		<ul>
			<li class="z-crt"><a href="javascript:void(0);"><i class="fa fa-list-ol"></i>名册</a></li>
			<li><a href="javascript:void(0);" onclick="addNew()"><i class="fa fa-plus-circle"></i>添加信息</a></li>
		</ul>
	</div>
	<div id="bodyer">
	<div class="u-callout u-callout-success">
		<form action="/" method="post" class="m-form-inline">
			<span>姓名：</span>
			<input name="kw" type="text" value="" class="u-input" />
			<button type="button" class="u-btn u-btn-sm u-btn-green" id="search-btn"><i class="fa fa-search"></i>查询</button>
		</form>
	</div>
	<table class="m-table m-table-row">
		<thead>
			<tr>
				<th style="width:3em;">序号</th>
				<th style="width:8em;">姓名</th>
				<th style="width:8em;">性别</th>
				<th>身份证号码</th>
				<th>单位</th>
				<th>职务</th>
				<th style="width:11em;">--</th>
			</tr>
		</thead>
		<tbody id="row-body"></tbody>
	</table>
	<div id="pager"></div>
	<div class="u-callout u-callout-info">
		<button class="u-btn u-btn-green" type="button" id="json-btn"><i class="fa fa-file-excel-o"></i>导出上报文件</button>
	</div>
	</div>
	</div>
	<script type="text/x-jsrender" id="row-tmpl">
		<tr>
			<td>{{:index}}</td>
			<td><a href="javascript:void(0);" data-id="{{:Id}}" class="edit-btn"><i class="fa fa-edit"></i>{{:A0101}}</a></td>
			<td>{{:A0107Text}}</td>
			<td>{{:A0177}}</td>
			<td>{{:A01CUnit}}</td>
			<td>{{:A01CJob}}</td>
			<td>
				<a href="javascript:void(0);" data-id="{{:Id}}" class="word-btn"><i class="fa fa-file-word-o"></i>生成word</a>
				|
				<a href="javascript:void(0);" data-id="{{:Id}}" class="delete-btn"><i class="fa fa-times-circle"></i>删除</a>
				
			</td>
		</tr>
	</script>
	<script type="text/javascript">
		$(function(){
			var $rows=$('#row-body');
			var $tmpl=$('#row-tmpl');
			var $pager=$('#pager').ch2Pager({
					pageindex:1,
					pagesize:12,
					onClickItem:function(total,p,s,param){
						loadData(p,s,param);
					}
				});
			var loadData=function(p,s,param){
				$rows.empty();
				var data=getList(p,s,param);
				if(data.total){
					$.each(data.rows,function(index,e){
						e.index=index+1;
						e.A0107Text=getStandard('GBT2261.1',e.A0107);
						$rows.append($tmpl.render(e));
					});
					
				}

				$pager.setData(data.total, p, s,param);
			};
			loadData(1,12,{});
			$('#search-btn').on('click',function(){
				var kw=$('[name="kw"]').val();
				loadData(1,12,{kw:kw});
			});
			$(document).on('click','.delete-btn',function(){
				var id=$(this).attr('data-id');
				var $row=$(this).closest('tr');
				$.ch2Confirm('删除提示','确认删除吗?',function(b,m){
					if(deleteRow(id)){
						loadData(1,12,{kw:$('[name="kw"]').val()});
						m.show(false);
					}else{
						$.ch2Alert('删除失败!');
					}
				});
			});
			$(document).on('click','.edit-btn',function(){
				var id=$(this).attr('data-id');
				editCommand(id);
			});
			$(document).on('click','#json-btn',function () {
				saveJson();
			});
			$(document).on('click','.word-btn',function () {
				var id=$(this).attr('data-id');
				saveWord(id);
			});
			//$(document).on('click','.test-btn',function(){
			//	var id=$(this).attr('data-id');
			//	jsTest(id);
			//});
		});
	</script>
</body>
</html>